package com.huawei.leetcode;

import java.util.ArrayList;
import java.util.List;

public class Code283 {
    public static void main(String[] args) {
        int[] nums = {0, 1, 0, 3};
        new Code283().moveZeroes(nums);
    }

    public void moveZeroes(int[] nums) {
        int i = 0;
        int j = 1;
        if (nums[i] == 0 && nums[j] != 0) {

        }
    }

    public void moveZeroes2(int[] nums) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != 0) {
                list.add(nums[i]);
            }
        }
        for (int i = 0; i < nums.length; i++) {
            if (i >= list.size()) {
                nums[i] = 0;
                continue;
            }
            nums[i] = list.get(i);
        }
    }
}
